<template>
<div class="after-sale views-container">
    <el-dialog :visible.sync="dialogVisibleImg" width="35%" custom-class="reset-pwd wlm-form-dialog dialog-table">
        <div class="wlm-form">
            <div class="wlm-form-header wlm-dialog-fixheader">
                <span class="wlm-dialog-inlenr">发货信息</span>
            </div>
            <div class="wlm-form-content">
                <el-form size="small" label-width="120px" class="retail-form" label-position="right">
                    <el-form-item label="发货用户：">
                        <p>{{busSendnickname}}</p>
                    </el-form-item>
                    <el-form-item label="用户id：">
                        <p>{{busSendData.user_id}}</p>
                    </el-form-item>
                    <el-form-item label="收货人：">
                        <p>{{busSendData.name}}</p>
                    </el-form-item>
                    <el-form-item label="联系方式：">
                        <span>{{busSendData.phone}}</span>
                    </el-form-item>
                    <el-form-item label="收货地址：" v-if="busSendData">
                        <span>{{`${busSendData.region.province}${busSendData.region.region}${busSendData.region.city}${busSendData.detail}`}}</span>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </el-dialog>
    <el-dialog @close="resetDialogFormData({is_agree:'10',express_name:'',express_no:'',refuse_desc:'',receive_name:'',receive_phone:'',receive_detail:'',refund_money:''})" :visible.sync="dialogTableVisible" custom-class="reset-pwd wlm-form-dialog dialog-table">
        <div class="wlm-form" v-if="dialogTableVisible">
            <div class="wlm-form-header wlm-dialog-fixheader">
                <span class="wlm-dialog-inlenr">{{formType == '1'?'商家发货':formType == '2'? '审核申请' :formType == '3'?'审核换货':formType == '4'?'退款':'-'}}</span>
            </div>
            <el-scrollbar wrap-class="scrollbar-wrapper">
                <div class="wlm-form-content">
                    <div class="wlm-dialog-main">
                        <div class="wlm-dialog-content">
                            <el-form ref="userForm" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="120px" class="retail-form" label-position="right">
                                <template v-if="formType === '1'">
                                    <!-- <el-form-item label="同意发货">
                                        <el-radio-group v-model="formFormatData.formData.status">
                                            <el-radio label="0">同意</el-radio>
                                            <el-radio label="1">不同意</el-radio>
                                        </el-radio-group>
                                    </el-form-item> -->
                                    <!-- <el-form-item label="原因" prop="reason" v-if="formFormatData.formData.status === '1'">
                                        <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 4}" v-model.trim="formFormatData.formData.reason">
                                        </el-input>
                                    </el-form-item> -->
                                    <el-form-item label="默认快递公司" prop="express_name">
                                        <el-select v-model="formFormatData.formData.express_name" placeholder="请选择">
                                            <el-option v-for="(item,index) in expressList" :key="index" :label="item" :value="item">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                    <el-form-item label="物流单号" prop="express_no">
                                        <el-input v-model.trim="formFormatData.formData.express_no">
                                        </el-input>
                                    </el-form-item>
                                </template>
                                <template v-if="formType === '2'">
                                    <el-form-item label="同意申请">
                                        <el-radio-group v-model="formFormatData.formData.is_agree">
                                            <el-radio label="10">同意</el-radio>
                                            <el-radio label="20">不同意</el-radio>
                                        </el-radio-group>
                                    </el-form-item>
                                    <el-form-item label="原因" prop="reason" v-if="formFormatData.formData.is_agree === '20'">
                                        <el-input v-model.trim="formFormatData.formData.refuse_desc">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="收货人姓名" v-if="formFormatData.formData.is_agree === '10'">
                                        <el-input v-model="formFormatData.formData.receive_name">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="联系电话" v-if="formFormatData.formData.is_agree === '10'">
                                        <el-input v-model="formFormatData.formData.receive_phone">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="发货地址" v-if="formFormatData.formData.is_agree === '10'">
                                        <el-input v-model="formFormatData.formData.receive_detail">
                                        </el-input>
                                    </el-form-item>
                                </template>
                                <template v-if="formType === '3'">
                                    <el-form-item label="审核换货">
                                        <el-radio-group v-model="formFormatData.formData.is_agree">
                                            <el-radio label="10">同意</el-radio>
                                            <el-radio label="20">不同意</el-radio>
                                        </el-radio-group>
                                    </el-form-item>
                                    <el-form-item label="原因" prop="reason" v-if="formFormatData.formData.is_agree === '20'">
                                        <el-input v-model.trim="formFormatData.formData.refuse_desc">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="收货人姓名" v-if="formFormatData.formData.is_agree === '10'">
                                        <el-input v-model="formFormatData.formData.receive_name">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="联系电话" v-if="formFormatData.formData.is_agree === '10'">
                                        <el-input v-model="formFormatData.formData.receive_phone">
                                        </el-input>
                                    </el-form-item>
                                    <el-form-item label="发货地址" v-if="formFormatData.formData.is_agree === '10'">
                                        <el-input v-model="formFormatData.formData.receive_detail">
                                        </el-input>
                                    </el-form-item>
                                </template>
                                <template v-if="formType === '4'">
                                    <el-form-item label="是否退款">
                                        <el-radio-group v-model="formFormatData.formData.is_agree" @change="refundChange">
                                            <el-radio label="10">同意</el-radio>
                                            <el-radio label="20">不同意</el-radio>
                                        </el-radio-group>
                                    </el-form-item>
                                    <el-form-item label="原因" v-if="formFormatData.formData.is_agree === '20'">
                                        <el-input type="textarea" v-model.trim="formFormatData.formData.refuse_desc"></el-input>
                                    </el-form-item>
                                    <el-form-item label="订单退款处退款方式" v-if="formFormatData.formData.is_agree=='10'" >
                                            <el-radio-group v-model="formFormatData.formData.refund_root" style="margin-left:20px;">
                                                <el-radio label="1">退款至余额</el-radio>
                                                <el-radio label="2">原路返回</el-radio>
                                                <el-radio label="3">默认</el-radio>
                                            </el-radio-group>
                                    </el-form-item>
                                    <el-form-item label="退款金额" v-if="formFormatData.formData.is_agree=='10'">
                                        <el-input v-model.trim="formFormatData.formData.refund_money">
                                        </el-input>
                                    </el-form-item>
                                     <el-form-item
                                        label="追回佣金"
                                        v-if="is_settled==1"
                                        >
                                        <el-radio-group
                                            v-model="formFormatData.formData.recover"
                                            style="margin-left:20px;"
                                        >
                                            <el-radio label="1">是</el-radio>
                                            <!-- <el-radio label="2">否</el-radio> -->
                                        </el-radio-group>
                                        <!-- <div class="form-help">注：立即到账才能追回佣金</div> -->
                                        </el-form-item>
                                     
                                </template>
                            </el-form>
                        </div>
                    </div>
                </div>
            </el-scrollbar>
        </div>
        <footer class="flex-row  flex-justify-c flex-align-c wlm-dialog-fixfooter">
            <el-button size="small" type="primary" :disabled="isFormFormatSave" :loading="isFormFormatSave" @click="formFormatSubmit">确定</el-button>
        </footer>
    </el-dialog>
    <div class="wlm-table">
        <div class="wlm-table-header">
            <el-form :model="tableFormatData.announcement.files" size="small" label-width="95px" class="retail-form" label-position="right">
                <el-form-item label="订单编号：" class="filter">
                    <el-input @keyup.enter.native="filesSerch" v-model="tableFormatData.announcement.files.order_no" placeholder="请输入订单编号" style="width:200px;"></el-input>
                </el-form-item>
                <el-form-item label="" class="filter">
                    <el-form-item label="售后类型：">
                        <el-select v-model="tableFormatData.announcement.files.type" placeholder="请选择" style="width:155px;">
                            <el-option :label="'全部'" value="0">
                            </el-option>
                            <el-option :label="'退款'" value="30">
                            </el-option>
                            <el-option :label="'退款退货'" value="10">
                            </el-option>
                            <el-option :label="'换货'" value="20">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="消费方式：">
                        <el-select v-model="tableFormatData.announcement.files.express_type" placeholder="请选择" style="width:155px;">
                            <el-option :label="'快递发货'" value="1">
                            </el-option>
                            <el-option :label="'核销'" value="3">
                            </el-option>
                            <el-option :label="'自提'" value="2">
                            </el-option>
                            <el-option :label="'卡密'" value="4">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form-item>
                <el-form-item label="" class="filter-btns">
                    <el-button type="primary" @click="filesSerch">筛选</el-button>
                    <el-button plain icon="document" :data-query="JSON.stringify(tableFormatData.announcement.files)" v-exceldown="{path:'getRefundList&', query: {export: 1}}">{{ $t('excel.export') }} </el-button>
                    <el-button type="text" @click="filesEmpty">清空筛选条件</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div class="wlm-table-content">
            <el-tabs v-model="tableFormatData.announcement.files.status" type="card" @tab-click="filesSerch">
                <!-- @tab-click="filesSerch" -->
                <el-tab-pane label="全部订单" name="0"></el-tab-pane>
                <el-tab-pane :label="`待处理(${afterNumber})`" name="1"></el-tab-pane>
                <el-tab-pane label="已拒绝" name="2"></el-tab-pane>
                <el-tab-pane label="已完成" name="3"></el-tab-pane>
                <!-- <el-tab-pane label="已取消" name="4"></el-tab-pane> -->
            </el-tabs>
            <el-table :ref="tableFormatData.announcement.key" :data="tableFormatData.announcement.tableData" @selection-change="handleSelectionChange" style="width: 100%;">
                <el-table-column label="" align="left" class-name="no-column">
                    <el-table-column type="selection" width="30" class-name="no-bor">
                    </el-table-column>
                    <el-table-column label="商品信息" align="left" class-name="no-bor">
                        <template slot-scope="scope">
                            <div class="flex-row  mar-col goods-list">
                                <img v-if="scope.row.order_goods_info.image" width="50" height="50" :src="scope.row.order_goods_info.image.file_path" style="margin-right:10px;">
                                <el-popover class="scale-grow" placement="top-start" width="200" trigger="hover" :content="scope.row.order_goods_info.goods_name">
                                    <p slot="reference" class="ellips_line2">{{ scope.row.order_goods_info.goods_name }}</p>
                                </el-popover>
                                <!-- <span class="scale-grow">{{scope.row.order_goods_info.goods_name}}</span> -->
                            </div>
                            <div class="flex-row " style="background:rgb(235, 238, 245);position: absolute;top: 0;left: -30px;right: -9999px;padding: 12px;">
                                <span class="no-nowrap" style="margin-left: 27px;">订单编号:{{scope.row.order_no}}</span>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column label="单价/数量" class-name="no-bor">
                        <template slot-scope="scope" class="">
                            <div class="flex-col  goods-list">
                                <p><span class="orders-red">￥</span>{{scope.row.order_goods_info.goods_price}}</p>
                                <p>{{scope.row.order_goods_info.total_num || 0}}件</p>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column label="售后">
                        <template slot-scope="scope">
                            <div class="flex-col  goods-list">
                                <template>
                                    <span>{{afterNewStatus[`${scope.row.status}`]}}</span>
                                    <router-link class="wlm-text" tag="span" :to="{path:'/orders/afterSaleDetail', query:{order_refund_id:scope.row.order_refund_id,express_type:scope.row.express_type}}">
                                        <el-button class="orders-red" type="text">售后详情</el-button>
                                    </router-link>
                                </template>
                            </div>
                        </template>
                    </el-table-column>
                </el-table-column>
                <el-table-column prop="date" label="实付款/订单来源">
                    <template slot-scope="scope">
                        <div class="flex-col  pad-t-50">
                            <p><span class="orders-red">￥</span>{{scope.row.order_goods_info.total_pay_price}}</p>
                            <p class="orders-gray font-12" v-if="scope.row.express_type==1">运费:{{scope.row.express_price}}元</p>
                            <el-tooltip class="item" effect="dark" :content="sourceType[`${scope.row.source}`]" placement="top">
                                <img height="20" width="20" :src="sourceImg[`${scope.row.source || '--'}`]" alt="">
                            </el-tooltip>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="date" label="买家">
                    <template slot-scope="scope">
                        <div class="flex-col  pad-t-50">
                            <template>
                                <p>
                                    <router-link tag="span" :to="{path:'/user/managementUserEdit', query:{user_id:scope.row.user_id}}">
                                        <el-button type="text">{{scope.row.nickName}}</el-button>
                                    </router-link>
                                </p>
                                <p>{{`${scope.row.realname}`}}</p>
                                <p>{{`${scope.row.mobile || '-'}`}}</p>
                            </template>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="date" label="下单时间">
                    <template slot-scope="scope">
                        <div class="flex-col  pad-t-50">
                            <span>{{scope.row.create_time || '-'}}</span>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="date" label="消费/支付方式">
                    <template slot-scope="scope">
                        <div class="flex-col  pad-t-50">
                            <div class="opacity-0">
                                <span></span>
                            </div>
                            <div class="flex-col flex-justify-c ">
                                <span class="mar-col">{{scope.row.express_type==1?'快递':(scope.row.express_type==2?'自提':'核销')}}</span>
                                <span class="mar-col" v-if="scope.row.pay_type!='balance'">{{`${payType[scope.row.pay_type||'-']}支付`}}</span>
                                <span class="mar-col" v-if="scope.row.pay_type=='balance'">{{scope.row.pay_type_str}}支付</span>
                                <!-- <el-button size="small" type="primary" @click="dialogRefund = true">确认退款</el-button> -->
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="date" label="售后类型/处理状态">
                    <template slot-scope="scope">
                        <div class="flex-col  pad-t-50">
                            <div class="opacity-0">
                                <span></span>
                            </div>
                            <div class="flex-col flex-justify-c ">
                                <span class="mar-col">{{scope.row.type==10?'退货退款':(scope.row.type==20?'换货':'退款')}}</span>
                                <span class="mar-col">{{afterSaleStatus[`${scope.row.status}`]}}</span>
                                <!-- <el-button size="small" type="primary" @click="dialogRefund = true">确认退款</el-button> -->
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="address" min-width="100" label="操作">
                    <template slot-scope="scope">
                        <div class="flex-col  pad-t-50">
                            <div style="position: absolute;right: 15px;top:5px;">
                                <router-link class="wlm-text" tag="span" :to="{path:`${linkDetailType[`${scope.row.express_type}`]}`, query:{order_id:scope.row.order_id,nickName:scope.row.nickName,user_id:scope.row.user_id}}">
                                    <el-button type="text">查看订单</el-button>
                                </router-link>
                            </div>
                            <p>{{scope.row.state_text}}</p>
                            <!-- 展示button -->
                            <div class="operation-group flex-row">
                                <div style="position: relative;white-space: nowrap;">
                                    <template v-if="scope.row.express_type=='1'&&scope.row.is_agree=='0'&&scope.row.status!='4'">
                                        <!-- 审核申请 -->
                                        <el-button v-if="scope.row.type=='10'" class="wlm-text" type="text" @click="showDialog({formType:'2',params:{id:scope.row.order_refund_id,toggle:'dialogTableVisible',noEdit:true}})">审核申请</el-button>
                                        <!-- 审核换货 -->
                                        <el-button v-if="scope.row.type=='20'" class="wlm-text" type="text" @click="showDialog({formType:'3',params:{id:scope.row.order_refund_id,toggle:'dialogTableVisible',noEdit:true}})">审核换货</el-button>
                                    </template>
                                    <!-- 商家发货 -->
                                    <el-button v-if="scope.row.status!='4'&& scope.row.is_bus_send != '1'&&scope.row.express_type=='1'&&scope.row.is_user_send=='1'&&scope.row.type=='20'&&scope.row.is_agree=='10'" class="wlm-text" type="text" @click="showDialog({formType:'1',params:{id:scope.row.order_refund_id,toggle:'dialogTableVisible',noEdit:true}})">商家发货</el-button>
                                    <!-- 退款 -->
                                    <el-button v-if="scope.row.status!='4'&&!scope.row.refund_time&&scope.row.express_type!='1'&&scope.row.is_agree=='0'" class="wlm-text" type="text" @click="showDialog({formType:'4',params:{id:scope.row.order_refund_id,toggle:'dialogTableVisible',noEdit:true},express_price:scope.row.express_price,update_price:scope.row.update_price,is_settled:scope.row.is_settled},scope.row.express_type == '3' ? scope.row.vercode : scope.row.order_goods_info.total_pay_price, true)">退款</el-button>
                                    <el-button v-if="scope.row.status!='4'&&!scope.row.refund_time&&scope.row.express_type=='1'&&scope.row.type=='10'&&scope.row.is_agree=='10'&&scope.row.is_user_send=='1'" class="wlm-text" type="text" @click="showDialog({formType:'4',params:{id:scope.row.order_refund_id,toggle:'dialogTableVisible',noEdit:true},express_price:scope.row.express_price,update_price:scope.row.update_price},[scope.row.order_goods_info.total_pay_price,scope.row.express_price])">退款</el-button>
                                    <el-button v-if="scope.row.status!='4'&&!scope.row.refund_time&&scope.row.express_type=='1'&&scope.row.type=='30'&&scope.row.is_agree=='0'" class="wlm-text" type="text" @click="showDialog({formType:'4',params:{id:scope.row.order_refund_id,toggle:'dialogTableVisible',noEdit:true},express_price:scope.row.express_price,update_price:scope.row.update_price},[scope.row.order_goods_info.total_pay_price,scope.row.express_price])">退款</el-button>

                                    <el-button v-if="scope.row.status!='1'&&scope.row.status!='5'" class="wlm-text" type="text" @click="closeConfirm(scope.row.order_refund_id)">关闭订单</el-button>
                                    <span v-if="scope.row.status=='5'">订单已关闭</span>
                                    <span v-if="scope.row.status!='4'&&!scope.row.refund_time&&scope.row.express_type=='1'&&scope.row.type!='30'&&scope.row.is_agree=='10'&&scope.row.is_user_send=='0'">待用户发货</span>
                                    <el-button @click="openBusSend({order_id:scope.row.order_id,nickName:scope.row.nickName,user_id:scope.row.user_id},scope.row.nickName)" v-if="scope.row.type=='20'&&scope.row.express_type=='1'&&scope.row.is_bus_send=='1'&&scope.row.is_agree=='10'" type="text">发货信息</el-button>
                                </div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination-content flex-row flex-justify-b flex-align-c">
                <el-row class="pagination-btns">
                    <el-checkbox class="check-all" true-label="1" false-label="0" v-model="tableFormatData.announcement.files.checkall" @change="toggleSelection">全部</el-checkbox>
                    <!-- <el-button class="right-8" :disabled="isGroup" @click="changeTableItem({isGroup:true},tableFormatData.announcement.change.refund,{isWarning: true,warning:'确定是否帮助用户退款？',cancel:'已取消'})" type="primary" size="mini">批量退款</el-button> -->
                </el-row>
                <el-pagination :disabled="!hasTableData" @size-change="listPageChange" @current-change="listPageChange" :current-page.sync="tableFormatData.announcement.pagination.page" :page-sizes="tableFormatData.announcement.pagination.pagesizes" :page-size.sync="tableFormatData.announcement.pagination.list_rows" layout="total, sizes, prev, pager, next, jumper" :total="hasTableData?tableFormatData.announcement.pagination.total : 0">
                </el-pagination>
            </div>
        </div>
    </div>
</div>
</template>

<script>
import {
  getRefundList,
  orderSend,
  orderDetail,
  getExpress,
  refundStoreSendGoods,
  RefundApplyToExamine,
  startRefund,
  delRefundApplyInfo,
  closeRefundApplyOrder
} from '@/api/orders'
import { numberAdd } from '@/utils/index'
import exceldown from '@/directive/exceldown'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Table'), mixins.getters('Form')],
  name: 'AfterSale',
  computed: {

  },
  created() {
    numberAdd([1, 3, 5], [2, 6.77, 8.666])
    this.$nextTick(() => {
      getExpress().then((response) => {
        const { data: { data: msgData = [] } } = response
        this.expressList = msgData
      })
    })
  },
  components: {

  },
  directives: {
    exceldown
  },
  data() {
    return {
      afterNumber: '',
      is_settled:'',
      busSendData: '',
      busSendnickname: '',
      dialogVisibleImg: false,
      linkDetailType: {
        '4': 'ordersCardPasswordManagementDetail',
        '3': '/orders/ordersVerificationManagementDetail',
        '2': '/orders/ordersComeStoreManagementDetail',
        '1': '/orders/ordersExpressManagementDetail'
      },
      verificationSerch: '',
      dialogTableVisible: false,
      filename: '订单列表',
      autoWidth: true,
      bookType: 'csv',
      afterSaleStatus: {
        '1': '待处理',
        '2': '已拒绝',
        '3': '已完成',
        '4': '已取消',
        '5': '已关闭'
      },
      afterNewStatus: {
        '1': '售后中',
        '2': '售后拒绝',
        '3': '售后完成',
        '4': '售后取消',
        '5': '售后关闭'
      },
      payType: {
        'wechat': '微信',
        'admin': '后台确认',
        'alipay': '支付宝',
        'balance': '余额',
        'zero': '零元',
        '-': '-'
      },
      formFormatData: {
        key: 'userForm',
        model: {
          noCreateEdit: false,
          bindDialog: 'dialogTableVisible'
        },
        api: {
          editForm: {
            api: '',
            params: {
              id: ''
            },
            redirect: 'order_refund_id'
          },
          submitForm: orderSend
        },
        formData: {
          order_refund_id: '',
          is_agree: '10',
          express_name: '',
          recover:'1',
          express_no: '',
          refuse_desc: '',
          receive_name: '',
          receive_phone: '',
          receive_detail: '',
          refund_money: '',
          refund_root:'3',
          status: '0'
        },
        rules: {

        }
      },
      tableFormatData: {
        current: 'announcement',
        announcement: {
          key: 'announcement',
          api: {
            getList: getRefundList,
            delList: delRefundApplyInfo
          },
          tableData: [],
          files: {
            order_no: '',
            type: '',
            order_type: '0',
            time: [],
            express_type: '',
            ids: [],
            checkall: '0',
            Recycle: '0',
            redirect: 'order_refund_id'
          },
          pagination: {
            page: 1,
            list_rows: 10,
            pagesizes: [10, 20, 50],
            total: 10
          }
        }
      }
    }
  },
  methods: {
    openBusSend(params, nickname) {
      this.busSendnickname = nickname
      orderDetail(params).then((response) => {
        const {
          data: {
            data: msgData = {}
          }
        } = response
        this.busSendData = msgData.detail.address
      })
      this.dialogVisibleImg = true
    },
    closeConfirm(order_refund_id) {
      this.$confirm('是否确认关闭订单?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        closeRefundApplyOrder({ ids: [order_refund_id] }).then((response) => {
          this.$message({
            type: 'success',
            message: '关闭成功!'
          })
          this.filesSerch()
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消关闭'
        })
      })
    },
    changeRefundMoney(express_price, update_price, price) {
      if (update_price !== '0.00') {
        this.formFormatData.formData.refund_money = ((price * 1000) - (express_price * 1000)) / 1000
      } else {
        this.formFormatData.formData.refund_money = price
      }
    },
    showDialog({ formType, params, express_price, update_price,is_settled}, price, isVercode) {
        this.is_settled = is_settled
      this.formType = formType
      if (Array.isArray(price)) {
        if (isVercode) {
          const numcount = []
          price.map(item => {
            numcount.push(item.pay_money)
          })
          this.changeRefundMoney(express_price, update_price, numberAdd(...numcount))
        } else {
          this.changeRefundMoney(express_price, update_price, numberAdd(...price))
          console.log(price, 'price')
        }
      } else {
        this.formFormatData.formData.refund_money = price
        console.log(price, 'price2')
      }
      if (formType === '1') {
        this.formFormatData.api.submitForm = refundStoreSendGoods
      } else if (formType === '2' || formType === '3') {
        this.formFormatData.api.submitForm = RefundApplyToExamine
      } else if (formType === '4') {
        this.formFormatData.api.submitForm = startRefund
      }
      this.formFormatDialogEditEvt(params)
    },
    hasFirst(data) {
      let result = []
      result = data.filter(item => {
        return item.value === 1
      })
      return result.length > 1
    },
    refundChange(data) {
      if (data === '10') {
        this.formFormatData.api.submitForm = startRefund
      } else if (data === '20') {
        this.formFormatData.api.submitForm = RefundApplyToExamine
      }
    },
    changeTableCallBack({ event, params: { response: { data: { data: { number } } } } }) {
      if (event === 'getList') {
        this.afterNumber = number
      }
    },
    updateTime(event) {
      const { target: { value = -1, attributes: { order_refund_id, order_type } } } = event
      this.extension[`${order_type.value}`] = value
      this.extension.order_refund_id = order_refund_id.value || ''
      console.log(this.extension)
    }
  }
}
</script>

<style lang="scss" scoped>
.after-sale {
    .logo {
        height: 32px;
        width: 32px;
        border-radius: 32px;
        vertical-align: middle;
    }

    /deep/ .is-left.no-column .cell {
        display: none !important;
    }

    & .orders-red {
        color: rgb(245, 108, 108);
    }

    /deep/ .el-table__body tr:hover>td {
        background-color: transparent !important;
    }

    /deep/ .el-table__row {
        .no-bor {
            border-right: none;
        }

        &:not(:nth-of-type(0)) {
            .no-bor .el-checkbox {
                position: absolute;
                top: 12px;
            }
        }
    }

    .pad-t-50 {
        padding-top: 48px;
    }

    .goods-list:nth-of-type(1) {
        padding-top: 48px;
    }

    // .order-box {
    //     padding: 20px;
    //     border: 1px solid #ebeef5;

    //     .order-list {
    //         white-space: nowrap;

    //         &+.order-list {
    //             margin-left: 20px;
    //         }
    //     }
    // }
    .opacity-0 {
        opacity: 0;
    }

    .mar-col {
        margin: 10px 0;
    }
}
</style>
